package cool.houge.wuneng.admin.system.repository;

import cool.houge.wuneng.common.DataFilter;
import cool.houge.wuneng.common.HBeanRepository;
import cool.houge.wuneng.entity.system.Department;
import cool.houge.wuneng.entity.system.query.QDepartment;
import io.ebean.Database;
import io.ebean.PagedList;
import jakarta.inject.Singleton;

/// 部门
///
/// @author ZY (kzou227@qq.com)
@Singleton
public class DepartmentRepository extends HBeanRepository<Integer, Department> {

    public DepartmentRepository(Database db) {
        super(Department.class, db);
    }

    /// 分页查询
    public PagedList<Department> findPage(DataFilter filter) {
        var qb = new QDepartment(db());
        apply(qb.query(), filter);
        return qb.findPagedList();
    }
}
